<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //1.数组的扩展
        let arr = [12, 23, 34]
        let arr2 = [...arr]//把原数组复制了一根

        console.log(arr2);
        console.log(arr === arr2);//两个数组指向不同的空间,所以false

        //2.json
        let person = {
            name: 'lee',
            age: 18,
            address: {
                province: "shanxi",
                city: '西安'
            }
        }
        let person2 = { ...person }
        console.log(person2);
        console.log(person === person2);
        console.log(person.address === person2.address);//true 说明只能扩展一级,两级里面的地址指的是相通的
        //扩展两级的写法
        console.log('扩展两级=============================================');
        let person3 = { ...person, address: { ...person.address } }
        console.log(person3);
        console.log(person === person3);
        console.log(person.address === person2.address);
        console.log('小技巧============================');
        let arr1 = [1, 2, 3, 4]
        let max = Math.max(...arr1)
        console.log(max);
        let str = 'abcde'
        let arr3 = [...str]
        console.log(arr3);

    </script>
</body>

</html>